﻿
@using System.Globalization;

<style type="text/css">
    .laytable-cell-1-AvatarPictureUrl {
        height: 100%;
        max-width: 100%;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
                <div class="layui-form  layui-form-pane layui-card-header layuiadmin-card-header-auto">
                    <div class="layui-form-item">
                        <button class="layui-btn  layui-btn-normal layuiadmin-btn-tags" style="float:right;" lay-submit lay-filter="LAY-app-exportexcel">导出筛选数据</button>
                    </div>
                </div>

            <table id="LAY-agentorder-list" lay-filter="LAY-agentorder-list"></table>
        </div>
    </div>
</div>

<script type="text/html" id="orderstatusTpl">
    {{#  if(d.OrderStatus==''){ }}
    <button class="layui-btn layui-btn-xs">已启用</button>
    {{#  } else if(d.OrderStatus=='') { }}
    <button class="layui-btn layui-btn-primary layui-btn-xs">未启用</button>
    {{#  } }}
</script>
<script>
    layui.use(['index', 'table'], function () {
            var index = layer.load(2, { shade: false });
            var table = layui.table
                , form = layui.form;
        //分类管理
        table.render({
            elem: '#LAY-agentorder-list'
            , url: '@Html.Raw(Url.Action("Orders", new { Id = ViewBag.Id }))' //模拟接口
            ,method:'post'
            , page: true //开启分页
            , even: true
            , limit: 15
            , limits: [15,30,50,100]
            , cols: [[
                { type: 'numbers' }
                , { field: 'OrderCode', width: 110, title: '订单号' }
                , { field: 'Nickname', title: '昵称', minWidth: 100 }
                , { field: 'Phone', title: '电话', width: 120, align: 'center' }
                , { field: 'OrderTotal', title: '订单金额', minWidth: 150 }
                , { field: 'OrderStatus', title: '状态',  width: 100, align: 'center' }
                , { field: 'CreatedTime', title: '时间', width: 180, align: 'center', templet: '<div>{{ layui.util.timeAgo(d.CreatedTime) }}</div>' }
            ]]
            , text: { none: '一条数据也没有^_^' }
            , done: function () {
                layer.close(index);
            }
         });

        //监听搜索
         layui.form.on('submit(LAY-app-exportexcel)', function (data) {
             var field = data.field;
             window.location.href = '@Url.Action("ExportOrderExcelAll")?CustomerId=' + @ViewBag.Id 
         });

        var $ = layui.$, active = {}
        $('.layui-btn.layuiadmin-btn-tags').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>







